<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/jquery.min.js"></script>
    <script type="text/javascript" src="./script/doT.min.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/api.js"></script>
    <style type="text/css">
        .header {
            padding: 2.5rem 0.5rem 2rem 0.5rem;
        }
    </style>
</head>

<body>
    <header class="aui-bar aui-bar-nav" style="padding-top:25px;">
        <a class="aui-pull-left aui-btn" onclick="closeWin()">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div class="aui-title">可大金服OA</div>
        <a class="aui-pull-right aui-btn nav-btn" id="headList">
            <!-- <span class="aui-iconfont aui-icon-more"></span> -->
        </a>
    </header>

    <!-- <div class="content-t" id="conHead">
        <p2 id="title"></p2>
        <p id="create_time"></p>
    </div> -->

    <div class="content-t" id="conHead">
        <p2 id="title"></p2>
        <p>
            <span>作者：<span2 id="conAuth">可大金服</span2></span>
            <span id="create_time">2018-11-20</span>
            <span>编号：<span2 id="conNum">JKD156846816516546</span2></span>
        </p>
    </div>

    <div class="content" id="content">
    </div>



    <script type="text/javascript" src="./script/api.js"></script>
    <script type="text/javascript">
        function openClub() {
            var delay = 0;
            if (api.systemType != 'ios') {
                delay = 300;
            }
            api.openWin({
                name: 'club_win',
                url: './html/club_win.html',
                bounces: false,
                delay: delay,
                slidBackEnabled: true,
                vScrollBarEnabled: false,
                progress: {
                    type: "page"
                }
            });
        }
        $(".nav-btn").on("click", function() {
            $(".nav").slideToggle(100);
        })
        $(".nav .aui-list-item").on("click", function() {
            $(".nav").hide();
        })

        function closeWin() {
            api.closeWin({});
        }

        function readPeople() {
            api.openWin({
                name: 'list',
                url: './list.html',
                pageParam: {
                    id: id,
                }
            });

        }

        function shenqing() {
            api.openWin({
                name: 'form',
                url: './form.html',
                pageParam: {
                    sender_id: sender_id,
                    con_id: id
                }
            });

        }

        var id = '';
        var sender_id = "";
        apiready = function() {



            id = api.pageParam.id; // 内容id
            var userid = $api.getStorage('id');
            updateData(id);



        }

        function updateData(id) {
            api.showProgress({
                style: 'default',
                animationType: 'fade',
                title: '努力加载中...',
                text: '先喝杯茶...',
                modal: false
            });
            var userid = $api.getStorage('id');

            var url = 'http://oa.big-wealth.com/index.php?m=&c=info&a=read_api&api_auth_id=' + userid + '&id=' + id;
            api.ajax({
                url: url,
                method: 'get',

            }, function(ret, err) {
                if (ret) {

                    // console.log(JSON.stringify(ret));
                    api.hideProgress();

                    var end_time = api.pageParam.end_time;
                       sender_id = api.pageParam.sender_id;
                       var name = api.pageParam.name;
                       var num = api.pageParam.num;
                      //  console.log(JSON.stringify(ret));

                       var timestamp = new Date().getTime();





                    updateCon(ret.date);
                } else {
                    alert(JSON.stringify(err));
                }
            });

        }

        function updateCon(data) {

            var index = getDate(data.create_time).search(' ')
            var create_time = getDate(data.create_time).substr(0, index);

            $("#title").text(data.name);
            $("#create_time").text(create_time);
            $("#content").html(data.content);

        }

        // function download_word() {
        //     var userid = $api.getStorage('id');
        //     var url = 'http://oa.big-wealth.com/index.php?m=&c=info&a=info_down&api_auth_id=' + userid + '&id=' + id;
        //
        //
        //     if (api.systemType == 'ios') {
        //         // delay = 300;
        //         api.openApp({
        //             iosUrl: url, //打开微信的，其中weixin为微信的URL Scheme
        //
        //         });
        //
        //     } else {
        //         api.openApp({
        //             androidPkg: 'android.intent.action.VIEW',
        //             mimeType: 'text/html',
        //             uri: url,
        //         }, function(ret, err) {
        //             if (ret) {
        //                 // alert(JSON.stringify(ret));
        //             } else {
        //                 // alert(JSON.stringify(err));
        //             }
        //         });
        //     }
        //
        // }
    </script>

</html>
